'use strict'
// Template version: 1.3.1
// see http://vuejs-templates.github.io/webpack for documentation.

const path = require('path')

module.exports = {
  // npm run dev会读取dev配置
  dev: {
    // Paths
    assetsSubDirectory: 'static',
    assetsPublicPath: '/',
    // 代理
    proxyTable: {
      '/api': { // 匹配所有以 '/api'开头的请求路径
        target: 'https://elm.cangdu.org', //'http://localhost:8001',// //  // 代理目标的基础路径
        changeOrigin: true,               // 支持跨域
        pathRewrite: {                    // 重写路径: 去掉路径中开头的'/api'
          '^/api': ''
        }
      }
    },

    // Various Dev Server settings
    host: '192.168.0.106', 
    port: 8080, 
    autoOpenBrowser: true,
    errorOverlay: true,
    notifyOnErrors: true,
    poll: false, 

    // 使用 Eslint
    useEslint: false,
    // If true, eslint errors and warnings will also be shown in the error overlay
    showEslintErrorsInOverlay: false,

    /**
     * Source Maps
     */
    // https://webpack.js.org/configuration/devtool/#development
    devtool: 'cheap-module-eval-source-map',
    // If you have problems debugging vue-files in devtools,
    // set this to false - it *may* help
    // https://vue-loader.vuejs.org/en/options.html#cachebusting
    cacheBusting: true,
    cssSourceMap: true,
    // 解决 内网穿透 Invalid Host header ???
    
    
  },

   // npm run build会读取build配置
  build: {
    // Template for index.html
    index: path.resolve(__dirname, '../dist/index.html'),
    // Paths
    assetsRoot: path.resolve(__dirname, '../dist'), //输出目录
    assetsSubDirectory: 'static',  //输出的资源目录
    assetsPublicPath: '/elm/',      //供外界访问的根目录

    // 
    productionSourceMap: false,
    devtool: '#source-map',
    // 是否gzip压缩
    productionGzip: true,
    productionGzipExtensions: ['js', 'css'],
    bundleAnalyzerReport: process.env.npm_config_report,

  }
}
